﻿using Ewk.MachineLearning.Genetic.Programming.Program.Terminals;

namespace Ewk.MachineLearning.Genetic.Programming.Program
{
    /// <summary>
    /// The variable node represents a variable of the program.
    /// </summary>
    internal class VariableNode : TerminalNode
    {
        private readonly Variable _variable;

        public VariableNode(Variable variable)
            : base(variable)
        {
            _variable = variable;
        }

        public void SetValue(dynamic value)
        {
            _variable.SetValue(value);
        }

        #region Overrides of Node

        public override Node Clone()
        {
            return this;
        }

        public override string ToString()
        {
            return _variable.Name;
        }

        #endregion
    }
}